package com.lee.boot.head.first.demo.config;//package com.lee.springboot.web.config;
//
//import com.baomidou.mybatisplus.core.MybatisSqlSessionFactoryBuilder;
//import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.apache.ibatis.session.SqlSessionFactoryBuilder;
//import org.mybatis.spring.SqlSessionTemplate;
//import org.mybatis.spring.support.SqlSessionDaoSupport;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//
//import javax.sql.DataSource;
//
//@Configuration
//public class SqlSessionFactoryConfig extends SqlSessionDaoSupport {
//
//    @Autowired
//    DataSource dataSource;
//
//    @Bean("mybatisSqlSessionFactory")
//    @Primary
//    public SqlSessionFactory getMybatisFactory() throws Exception {
//        MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
//        factoryBean.setDataSource(dataSource);
//        return factoryBean.getObject();
//    }
//
//    @Bean("sqlSessionTemplate")
//    public SqlSessionTemplate getSqlSessionTemplate(@Qualifier("mybatisSqlSessionFactory") SqlSessionFactory mybatisSqlSessionFactory) {
//        return new SqlSessionTemplate(mybatisSqlSessionFactory);
//    }
//
//
//}
